package com.sbm.domain.model;

import java.util.ArrayList;
import java.util.List;

import com.sbm.springsecurity.SecurityPermissionInterface;
import com.sbm.springsecurity.SecurityRoleInterface;

import lombok.Data;

@Data
public class RoleModel implements SecurityRoleInterface {
	private String id;

	private String name;

	private String type;

	private List<PermissionModel> permissionList;

	@Override
	public List<SecurityPermissionInterface> getPermissions() {
		List<SecurityPermissionInterface> list = new ArrayList<SecurityPermissionInterface>();
		for (PermissionModel permission : permissionList) {
			if (permission instanceof SecurityPermissionInterface)
				list.add((SecurityPermissionInterface) permission);
		}
		return list;
	}
}